Ext.require([
    'Ext.tree.*',
    'Ext.data.*',
    'Ext.layout.container.HBox',
    'Ext.dd.*',
    'Ext.window.MessageBox'
]);
  
Ext.onReady(function() {
	$('img.img-collapsible').click(toggleTopHidden); 
	Ext.Ajax.request({
		method : 'POST',
		url : "/sys-report/getReportStyle",
		params : {
			q_id:q_code
		},
		async : false,
		success : function(response, options) {
			var respText = Ext.util.JSON.decode(response.responseText);
			var cssUrl = respText.cssUrl;
			var jsUrl = respText.jsUrl;
			// 如果默认样式为空
			if (isNull(cssUrl)) {
				cssUrl = "/report/page/plat/query/template/css/report.css";
			}
			if (isNull(jsUrl)) {
				jsUrl = "/report/page/plat/query/template/js/report.js";
			}

			var link = document.createElement("link");  
		    link.type = "text/css";  
		    link.rel = "stylesheet";  
		    link.href = cssUrl;  
		    document.getElementsByTagName("head")[0].appendChild(link);  
			$.ajaxSetup({
		        cache: true
		    });
		    $.getScript(jsUrl, function () {
		    	new Ext.panel.Panel ({
		    		renderTo:Ext.getBody(),
		    	    layout: 'fit',
		            height:'100%',
		            width:'100%',
		            border: false,
		            items: [initReportQueryPanel(q_code,q_condition,'hidden','1')]
		    	});
		    	getTitle(q_title);
		    });
		},
		failure : function(response, options) {
			Ext.MessageBox.minWidth = 120;
			Ext.Msg.alert('提示', '获取报表配置信息失败！');
		}
	});
});
